package BehavioralPattern.Strategy;

/**
 * @Classname : SaleStrategy
 * @Description : 策略
 * @Author : chentianyu
 * @Date 2023/2/26 10:37
 */

// 抽象策略
public interface SaleStrategy {

    void sell(float price);
}

// 具体策略
class NewCustomerSaleStrategy implements SaleStrategy {

    @Override
    public void sell(float price) {
        System.out.printf("新顾客原价出售：%.2f 元\n", price);
    }
}

// 具体策略
class OldCustomerSaleStrategy implements SaleStrategy {

    @Override
    public void sell(float price) {
        System.out.printf("老顾客九折出售：%.2f 元\n", 0.9 * price);

    }
}

// 具体策略
class OffSeasonSaleStrategy implements SaleStrategy {

    @Override
    public void sell(float price) {
        System.out.printf("淡季八折抛售：%.2f 元\n", 0.8 * price);
    }
}
